import {createRouter, createWebHistory} from "vue-router";
import index from "@/view/login/index/index.vue";
import reg from "@/view/login/reg.vue";
import home from "@/view/home.vue";
import forgetPassword from "@/view/login/index/forgetPassword.vue";
import Home from "@/components/Home.vue";
import Dictionary from "@/components/main/Dictionary.vue";



const routes=[
    {
        path:"/",
        component:home,
        redirect: "/login",
        children:[
            {path:"/login",component:index},
            {path:"/reg",component:reg},
            {path:"/forgetPassword",component:forgetPassword},
            // 用户中心及子路由
            {
                path: "/user",
                component: Home, // 重命名后的组件
                children: [
                    { path: "/user/dictionary", component:Dictionary} // 嵌套路由，路径不要带斜杠开头
                ]
            }
        ]
    }
];

//创建路由器
const router=createRouter({
    history:createWebHistory(),
    routes:routes
});
//导出路由
export default router;